package com.jiahe.video.controller;

import com.jiahe.video.context.AppContent;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("app")
public class IndexController {

    @GetMapping("appContent")
    public Object info(){
        return AppContent.getAppContent();
    }

    @GetMapping("jvm")
    public Object jvm(){
        Map<String,Object> map = new HashMap<>();
        long maxMemory = Runtime.getRuntime().maxMemory();
        map.put("maxMemory",(maxMemory / (1024 * 1024 * 1024)) + "GB");
        return map;
    }
}
